package cn.znzz.cjm.controller;

import cn.znzz.cjm.dto.VerifyCod;
import cn.znzz.cjm.service.IVerifyService;
import cn.znzz.cjm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.io.IOException;

@RestController
@RequestMapping("/verifycode")
public class VerifyController {

    @Autowired
    private IVerifyService verifyService;

    @GetMapping("/imageCode/{key}")
    public AjaxResult imageCode(@PathVariable("key") String key) throws IOException {
        return verifyService.imageCode(key);
    }
    @PostMapping("/sendSmsCode")
    public AjaxResult sendSmsCode(@RequestBody @Valid VerifyCod cod){
        return verifyService.sendSmsCode(cod);
    }
}
